package class1;

import java.util.Scanner;

public class text {

    /**
     * 选课管理系统
     */
    public static void main(String[] args) {
        Student stu0 = new Student(1001, "lily");
        String Name1 = "lily";
        String Password1 = "123";
        Course cour0 = new Course(001, "高数", "李老师", "教101", "周一13:30到15:10");
        Course cour1 = new Course(002, "线代", "周老师", "教102", "周二15:30到17:10");
        Course cour2 = new Course(003, "概率论", "王老师", "教103", "周三13:30到15:10");

        System.out.println("------------------------------");
        System.out.println("*                            *");
        System.out.println("*        欢迎进入选课系统         *");
        System.out.println("*                            *");
        System.out.println("------------------------------");
        System.out.println("请进行您的操作：");
        System.out.println("      1.进入");
        System.out.println("      0.退出");
        System.out.print("  请输入数字选项（0~1）");
        Scanner input = new Scanner(System.in);
        int str = input.nextInt();
        if (str >= 0 && str <= 2) {
            switch (str) {
            case 1:
                System.out.println("欢迎使用学生选课退课系统");
                System.out.println("请输入账号:");
                String name = input.next();
                System.out.println("请输入密码:");
                String password = input.next();
                while (true) {
                    if (name.equals(Name1) && password.equals(Password1)) {
                        System.out.println("欢迎lily");
                        System.out.println("1.选课" + "\n" + "2.退课" + "\n" + "3.查看课表" + "\n" + "4.退出");
                        int xuantuike = input.nextInt();
                        if (xuantuike == 1) {
                            System.out.println("选课" + "\n" + "1.高数" + "\n" + "2.线代" + "\n" + "3.概率论");
                            int xuanke = input.nextInt();
                            switch (xuanke) {
                            case 1:
                                stu0.addCourse(cour0);
                                System.out.println("选课成功");
                                continue;
                            case 2:
                                stu0.addCourse(cour1);
                                System.out.println("选课成功");
                                continue;
                            case 3:
                                stu0.addCourse(cour2);
                                System.out.println("选课成功");
                                continue;
                            case 12:
                                stu0.addCourse(cour0);
                                stu0.addCourse(cour1);
                                System.out.println("选课成功");
                                continue;
                            case 13:
                                stu0.addCourse(cour0);
                                stu0.addCourse(cour2);
                                System.out.println("选课成功");
                                continue;
                            case 23:
                                stu0.addCourse(cour1);
                                stu0.addCourse(cour2);
                                System.out.println("选课成功");
                                continue;
                            case 123:
                                stu0.addCourse(cour0);
                                stu0.addCourse(cour1);
                                stu0.addCourse(cour2);
                                System.out.println("选课成功");
                                continue;
                            }
                        }
                        if (xuantuike == 2) {
                            System.out.println("退课" + "\n" + "1.高数" + "\n" + "2.线代" + "\n" + "3.概率论");
                            int tuike = input.nextInt();
                            switch (tuike) {
                            case 1:
                                stu0.removeCourse(cour0);
                                System.out.println("退课成功");
                                continue;
                            case 2:
                                stu0.removeCourse(cour1);
                                System.out.println("退课成功");
                                continue;
                            case 3:
                                stu0.removeCourse(cour2);
                                System.out.println("退课成功");
                                continue;
                            }
                        }
                        if (xuantuike == 3) {
                            stu0.displayCourse();
                            continue;
                        } else {
                            break;
                        }
                    } else {
                        break;
                    }
                }
                break;
            case 0:
                System.exit(0);
            }
        }
    }
}